<!--<page-header [action]="phActionTpl">-->
<!--&lt;!&ndash;  <ng-template #phActionTpl>&ndash;&gt;-->
<!--&lt;!&ndash;    <button (click)="add()" nz-button nzType="primary">新建</button>&ndash;&gt;-->
<!--&lt;!&ndash;  </ng-template>&ndash;&gt;-->

<!--</page-header>-->
<page-header [title]="'用户信息'"></page-header>
<div nz-row [nzGutter]="4">
  <div nz-col nzSpan="4">
    <nz-tree [nzData]="nodes" [nzShowLine]="true" (nzClick)="nzEvent($event)"> </nz-tree>
  </div>
  <div nz-col nzSpan="20">
    <nz-card [nzBordered]="false">
      <form nz-form [nzLayout]="'inline'" (ngSubmit)="getData()" class="search__form">
        <div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
          <div nz-col nzMd="8" nzSm="24">
            <nz-form-item>
              <nz-form-label nzFor="no">用户账号</nz-form-label>
              <nz-form-control>
                <input nz-input [(ngModel)]="q.no" name="no" placeholder="请输入" id="no" />
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
            <nz-form-item>
              <nz-form-label nzFor="callNo">姓名</nz-form-label>
              <nz-form-control>
                <input nz-input id="callNo" />
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
            <nz-form-item>
              <nz-form-label nzFor="mobileNo">手机:</nz-form-label>
              <nz-form-control>
                <input nz-input id="mobileNo" />
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col nzMd="8" nzSm="24">
            <nz-form-item>
              <nz-form-label nzFor="status">使用状态</nz-form-label>
              <nz-form-control>
                <nz-select [(ngModel)]="q.status" name="status" id="status" [nzPlaceHolder]="'请选择'" [nzShowSearch]="true">
                  <nz-option *ngFor="let i of status; let idx = index" [nzLabel]="i.text" [nzValue]="idx"></nz-option>
                </nz-select>
              </nz-form-control>
            </nz-form-item>
          </div>

          <div nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
            <nz-form-item>
              <nz-form-label nzFor="updatedAt">更新日期</nz-form-label>
              <nz-form-control>
                <nz-date-picker id="updatedAt"></nz-date-picker>
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="expandForm ? 24 : 8" [class.text-right]="expandForm">
            <button nz-button type="submit" [nzType]="'primary'" [nzLoading]="loading">查询</button>
            <button nz-button type="reset" (click)="reset()" class="mx-sm">重置</button>
            <a (click)="expandForm = !expandForm">
              {{ expandForm ? '收起' : '展开' }}
              <i nz-icon [nzType]="expandForm ? 'up' : 'down'"></i>
            </a>
          </div>
        </div>
      </form>
      <button nz-button (click)="add(modalContent)" [nzType]="'primary'">
        <i nz-icon nzType="plus"></i>
        <span>新建</span>
      </button>
      <ng-container *ngIf="selectedRows.length > 0">
        <button nz-button>批量操作</button>
        <button nz-button nz-dropdown [nzDropdownMenu]="batchMenu" nzPlacement="bottomLeft">
          更多操作
          <i nz-icon nzType="down"></i>
        </button>
        <nz-dropdown-menu #batchMenu="nzDropdownMenu">
          <ul nz-menu>
            <li nz-menu-item (click)="remove()">删除</li>
            <li nz-menu-item (click)="approval()">批量审批</li>
          </ul>
        </nz-dropdown-menu>
      </ng-container>
      <div class="my-md">
        <nz-alert [nzType]="'info'" [nzShowIcon]="true" [nzMessage]="message">
          <ng-template #message>
            已选择
            <strong class="text-primary">{{ selectedRows.length }}</strong> 项&nbsp;&nbsp; 服务调用总计
            <strong>{{ totalCallNo }}</strong> 万
            <a *ngIf="totalCallNo > 0" (click)="st.clearCheck()" class="ml-lg">清空</a>
          </ng-template>
        </nz-alert>
      </div>
      <st #st [columns]="columns" [data]="data" [loading]="loading" (change)="stChange($event)">
        <ng-template st-row="status" let-i>
          <nz-badge [nzStatus]="i.statusType" [nzText]="i.statusText"></nz-badge>
        </ng-template>
      </st>
    </nz-card>
    <ng-template #modalContent>
      <form nz-form [formGroup]="form" [nzLayout]="'vertical'">
        <nz-card [nzBordered]="false" nzTitle="用户信息">
          <nz-row nzGutter="16">
            <nz-col nzLg="6" nzMd="12" nzSm="24">
              <nz-form-item>
                <nz-form-label nzFor="name">用户账号</nz-form-label>
                <nz-form-control nzErrorTip="请输入用户账号">
                  <input nz-input formControlName="userName" id="userName" placeholder="请输入用户账号" />
                </nz-form-control>
              </nz-form-item>
            </nz-col>
            <nz-col [nzXl]="{ span: 6, offset: 2 }" [nzLg]="{ span: 8 }" [nzMd]="{ span: 12 }" nzSm="24">
              <nz-form-item>
                <nz-form-label>用户姓名</nz-form-label>
                <nz-form-control nzErrorTip="请输入用户姓名">
                  <input nz-input formControlName="realName" id="realName" placeholder="请输入用户姓名" />
                </nz-form-control>
              </nz-form-item>
            </nz-col>
            <nz-col [nzXl]="{ span: 8, offset: 2 }" [nzLg]="{ span: 10 }" [nzMd]="{ span: 24 }" nzSm="24">
              <nz-form-item>
                <nz-form-label>用户邮箱</nz-form-label>
                <nz-form-control nzErrorTip="请输入用户邮箱">
                  <input nz-input formControlName="userEmail" id="userEmail" placeholder="请输入用户邮箱" />
                </nz-form-control>
              </nz-form-item>
            </nz-col>
          </nz-row>
          <nz-row nzGutter="16">
            <nz-col nzLg="6" nzMd="12" nzSm="24">
              <nz-form-item>
                <nz-form-label>手机号码</nz-form-label>
                <nz-form-control nzErrorTip="请输入手机号码">
                  <input nz-input formControlName="userMobile" id="userMobile" placeholder="请输入手机号码" />
                </nz-form-control>
              </nz-form-item>
            </nz-col>
            <nz-col [nzXl]="{ span: 6, offset: 2 }" [nzLg]="{ span: 8 }" [nzMd]="{ span: 12 }" nzSm="24">
              <nz-form-item>
                <nz-form-label>性别</nz-form-label>
                <nz-form-control nzErrorTip="请选择用户性别">
                  <nz-select formControlName="userGender" [nzPlaceHolder]="'请选择用户性别'" [nzShowSearch]="true">
                    <nz-option *ngFor="let i of userGender" [nzLabel]="i.label" [nzValue]="i.value"></nz-option>
                  </nz-select>
                </nz-form-control>
              </nz-form-item>
            </nz-col>
            <nz-col [nzXl]="{ span: 8, offset: 2 }" [nzLg]="{ span: 10 }" [nzMd]="{ span: 24 }" nzSm="24">
              <nz-form-item>
                <nz-form-label>状态</nz-form-label>
                <nz-form-control nzErrorTip="请选择在职状态">
                  <nz-select formControlName="userStatus" [nzShowSearch]="true" [nzPlaceHolder]="'请选择在职状态'">
                    <nz-option [nzLabel]="'在职'" [nzValue]="'0'"></nz-option>
                    <nz-option [nzLabel]="'离职'" [nzValue]="'1'"></nz-option>
                  </nz-select>
                </nz-form-control>
              </nz-form-item>
            </nz-col>
          </nz-row>
        </nz-card>

        <nz-card [nzBordered]="false" nzTitle="岗位信息">
          <nz-row nzGutter="16">
            <nz-col nzLg="6" nzMd="12" nzSm="24">
              <nz-form-item>
                <nz-form-label>所属公司</nz-form-label>
                <nz-form-control nzErrorTip="请选择所属公司">
                  <nz-tree-select
                    formControlName="userCompany"
                    style="width: 250px"
                    nzPlaceHolder="Please select"
                    [nzExpandedKeys]="expandKeys"
                    [(ngModel)]="value"
                    [nzDropdownMatchSelectWidth]="true"
                    [nzDropdownStyle]="{ 'max-height': '300px' }"
                    [nzNodes]="company"
                    [nzAsyncData]="true"
                    (nzExpandChange)="onExpandChange($event)"
                    (nzTreeClick)="nzCompanEvent($event)"
                  >
                  </nz-tree-select>
                </nz-form-control>
              </nz-form-item>
            </nz-col>
            <nz-col [nzXl]="{ span: 6, offset: 2 }" [nzLg]="{ span: 8 }" [nzMd]="{ span: 12 }" nzSm="24">
              <nz-form-item>
                <nz-form-label>所属机构</nz-form-label>
                <nz-form-control nzErrorTip="请选择所所属机构">
                  <nz-tree-select
                    [nzDisabled]="organDisabled"
                    formControlName="organName"
                    style="width: 250px"
                    nzPlaceHolder="Please select"
                    [nzExpandedKeys]="expandKeys"
                    [(ngModel)]="organName"
                    [nzDropdownMatchSelectWidth]="true"
                    [nzDropdownStyle]="{ 'max-height': '300px' }"
                    [nzNodes]="organ"
                    [nzAsyncData]="true"
                    (nzExpandChange)="onOrganExpandChange($event)"
                  >
                  </nz-tree-select>
                </nz-form-control>
              </nz-form-item>
            </nz-col>
            <nz-col [nzXl]="{ span: 8, offset: 2 }" [nzLg]="{ span: 10 }" [nzMd]="{ span: 24 }" nzSm="24">
              <nz-form-item>
                <nz-form-label>所属岗位</nz-form-label>
                <nz-form-control nzErrorTip="请选择所属岗位">
                  <nz-select formControlName="postName" [nzPlaceHolder]="'请选择所属岗位'" [nzShowSearch]="true">
                    <nz-option *ngFor="let i of post" [nzLabel]="i.label" [nzValue]="i.value"> </nz-option>
                  </nz-select>
                </nz-form-control>
              </nz-form-item>
            </nz-col>
          </nz-row>
          <nz-row>
            <textarea nz-input formControlName="standard" [nzAutosize]="{ minRows: 4 }" placeholder="备注说明"></textarea>
          </nz-row>
        </nz-card>
      </form>
    </ng-template>
  </div>
</div>
